package edu.zafu.ui.view;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;

public class SettingDialog extends Dialog {

	/**
	 * Create the dialog.
	 * @param parentShell
	 */
	public SettingDialog(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@SuppressWarnings("unused")
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		GridLayout gridLayout = (GridLayout) container.getLayout();
		gridLayout.numColumns = 8;
		
		Label label = new Label(container, SWT.NONE);
		label.setText("\u8FDF\u5230\u6263\u5206:");
		
		Spinner spinnerLate = new Spinner(container, SWT.BORDER);
		new Label(container, SWT.NONE);
		
		Label label_1 = new Label(container, SWT.NONE);
		label_1.setText("\u8BF7\u5047\u6263\u5206:");
		
		Spinner spinnerLeave = new Spinner(container, SWT.BORDER);
		new Label(container, SWT.NONE);
		
		Label label_2 = new Label(container, SWT.NONE);
		label_2.setText("\u65F7\u8BFE\u6263\u5206:");
		
		Spinner spinnerTruant = new Spinner(container, SWT.BORDER);
		
		Label label_3 = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
		label_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 8, 1));
		
		Label label_4 = new Label(container, SWT.NONE);
		label_4.setText("\u7B54\u9898\u6B63\u786E:");
		
		Spinner spinnerAnswerTrue = new Spinner(container, SWT.BORDER);
		new Label(container, SWT.NONE);
		
		Label label_5 = new Label(container, SWT.NONE);
		label_5.setText("\u7B54\u9898\u57FA\u672C\u6B63\u786E:");
		
		Spinner spinnerAnswerGTrue = new Spinner(container, SWT.BORDER);
		new Label(container, SWT.NONE);
		
		Label label_6 = new Label(container, SWT.NONE);
		label_6.setText("\u7B54\u9898\u9519\u8BEF:");
		
		Spinner spinnerAnswerError = new Spinner(container, SWT.BORDER);
		
		Label label_7 = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
		GridData gd_label_7 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 8, 1);
		gd_label_7.widthHint = 408;
		label_7.setLayoutData(gd_label_7);

		return container;
	}

	/**
	 * Create contents of the button bar.
	 * @param parent
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
				true);
		button.addSelectionListener(new PointSettingAciton());
		createButton(parent, IDialogConstants.CANCEL_ID,
				IDialogConstants.CANCEL_LABEL, false);
	}

	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(450, 300);
	}

}
